Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(subform): backend handling of datatype calls from preview #13971

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Jondyr
Copy link
Member

@Jondyr Jondyr commented Nov 4, 2024

Description

This PR solves preview of subform table components.

Changes made to backend:

  • Organized some endpoints in PreviewController
    • Two new controllers: DataController and InstanceController in a new directory preview/
      Moved over existing endpoints from PreviewController to these files
      Isolates preview backend calls from studio, and tries to stay true to altinn-app-api format for easier source lookup
  • Added DataService
    • Implement temporary storage of datatype objects using IDistributedCache implementation
    • Create, Get and Patch temporary stored datatype objects. (sliding cache of 30 minutes)
  • Added new models in new preview/ directory DataPatchRequest and DataPatchResponse
subform-component-preview-pr.mp4

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

@github-actions github-actions bot added area/app-preview Area: Related to test and preview of apps that are developed in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. backend labels Nov 4, 2024
@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Nov 4, 2024
@Jondyr Jondyr added the skip-releasenotes Issues that do not make sense to list in our release notes label Nov 4, 2024
@Jondyr Jondyr marked this pull request as ready for review November 4, 2024 11:36
Copy link
Contributor

@mlqn mlqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🚀

{
[Authorize]
[AutoValidateAntiforgeryToken]
[Route("{org:regex(^(?!designer))}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest moving /instances to the base route here, as you did with /data in the DataController?

Suggested change
[Route("{org:regex(^(?!designer))}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}")]
[Route("{org:regex(^(?!designer))}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/instances")]

{
public static class PreviewConstants
{
public static readonly Guid MockInstanceGUID = new("f1e23d45-6789-1bcd-8c34-56789abcdef0");
Copy link
Contributor

@mlqn mlqn Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant does not seem to be in use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app-preview Area: Related to test and preview of apps that are developed in Altinn Studio. backend quality/testing Tests that are missing, needs to be created or could be improved. skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend endpoint for preview datamodel json schema fails for subforms
2 participants